"""Changed backref to back_populates

Revision ID: 1382ea745a1d
Revises: 350332a6d5dd
Create Date: 2023-03-30 08:43:38.677703

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision = '1382ea745a1d'
down_revision = '350332a6d5dd'
branch_labels = None
depends_on = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('db_profile_fb_dolphin', sa.Column('user_id', sa.Integer(), nullable=True))
    op.drop_constraint('db_profile_fb_dolphin_ibfk_1', 'db_profile_fb_dolphin', type_='foreignkey')
    op.create_foreign_key(None, 'db_profile_fb_dolphin', 'user', ['user_id'], ['id'])
    op.drop_column('db_profile_fb_dolphin', 'customer')
    op.add_column('documents', sa.Column('user_id', sa.Integer(), nullable=True))
    op.drop_constraint('documents_ibfk_1', 'documents', type_='foreignkey')
    op.create_foreign_key(None, 'documents', 'user', ['user_id'], ['id'])
    op.drop_column('documents', 'customer')
    op.add_column('id_accounts', sa.Column('user_id', sa.Integer(), nullable=True))
    op.drop_constraint('id_accounts_ibfk_1', 'id_accounts', type_='foreignkey')
    op.create_foreign_key(None, 'id_accounts', 'user', ['user_id'], ['id'])
    op.drop_column('id_accounts', 'customer')
    op.add_column('tasks', sa.Column('user_id', sa.Integer(), nullable=True))
    op.drop_constraint('tasks_ibfk_1', 'tasks', type_='foreignkey')
    op.create_foreign_key(None, 'tasks', 'user', ['user_id'], ['id'])
    op.drop_column('tasks', 'customer')
    op.add_column('uniques', sa.Column('user_id', sa.Integer(), nullable=True))
    op.drop_constraint('uniques_ibfk_1', 'uniques', type_='foreignkey')
    op.create_foreign_key(None, 'uniques', 'user', ['user_id'], ['id'])
    op.drop_column('uniques', 'customer')
    op.add_column('whitepages', sa.Column('user_id', sa.Integer(), nullable=True))
    op.drop_constraint('whitepages_ibfk_1', 'whitepages', type_='foreignkey')
    op.create_foreign_key(None, 'whitepages', 'user', ['user_id'], ['id'])
    op.drop_column('whitepages', 'customer')
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('whitepages', sa.Column('customer', mysql.INTEGER(), autoincrement=False, nullable=True))
    op.drop_constraint(None, 'whitepages', type_='foreignkey')
    op.create_foreign_key('whitepages_ibfk_1', 'whitepages', 'user', ['customer'], ['id'])
    op.drop_column('whitepages', 'user_id')
    op.add_column('uniques', sa.Column('customer', mysql.INTEGER(), autoincrement=False, nullable=True))
    op.drop_constraint(None, 'uniques', type_='foreignkey')
    op.create_foreign_key('uniques_ibfk_1', 'uniques', 'user', ['customer'], ['id'])
    op.drop_column('uniques', 'user_id')
    op.add_column('tasks', sa.Column('customer', mysql.INTEGER(), autoincrement=False, nullable=True))
    op.drop_constraint(None, 'tasks', type_='foreignkey')
    op.create_foreign_key('tasks_ibfk_1', 'tasks', 'user', ['customer'], ['id'])
    op.drop_column('tasks', 'user_id')
    op.add_column('id_accounts', sa.Column('customer', mysql.INTEGER(), autoincrement=False, nullable=True))
    op.drop_constraint(None, 'id_accounts', type_='foreignkey')
    op.create_foreign_key('id_accounts_ibfk_1', 'id_accounts', 'user', ['customer'], ['id'])
    op.drop_column('id_accounts', 'user_id')
    op.add_column('documents', sa.Column('customer', mysql.INTEGER(), autoincrement=False, nullable=True))
    op.drop_constraint(None, 'documents', type_='foreignkey')
    op.create_foreign_key('documents_ibfk_1', 'documents', 'user', ['customer'], ['id'])
    op.drop_column('documents', 'user_id')
    op.add_column('db_profile_fb_dolphin', sa.Column('customer', mysql.INTEGER(), autoincrement=False, nullable=True))
    op.drop_constraint(None, 'db_profile_fb_dolphin', type_='foreignkey')
    op.create_foreign_key('db_profile_fb_dolphin_ibfk_1', 'db_profile_fb_dolphin', 'user', ['customer'], ['id'])
    op.drop_column('db_profile_fb_dolphin', 'user_id')
    # ### end Alembic commands ###
